from Products.Archetypes.public import process_types, listTypes
from Products.CMFCore import utils
from Products.CMFCore.DirectoryView import registerDirectory

from Products.ShoeBox.config import PROJECTNAME, \
	ADD_ACCOUNT_PERMISSION, ADD_ENTRY_PERMISSION, \
	ADD_SHOEBOX_PERMISSION, SKINS_DIR, GLOBALS

## Add each skin folder here
#registerDirectory(SKINS_DIR + '/newdir', GLOBALS)
registerDirectory(SKINS_DIR + '/ShoeBox', GLOBALS)

def initialize(context):	
	##
	## Adds validation
	##
#	import ShoeBoxValidation
#	from Products.validation import validation
	
#	AllowedUrl = ShoeBoxValidation.AllowedUrl("isAllowedUrl", PROTOCOLS,)
#	validation.register(AllowedUrl)
		
	## Import Types here to register them
	import ShoeBox, ShoeBoxAccount, ShoeBoxEntry

	##
	## Adds the new content type
	##
	content_types, constructors, ftis = process_types(
		listTypes(PROJECTNAME), PROJECTNAME)
	
	utils.ContentInit(
		PROJECTNAME + ' Content',
		content_types = content_types,
		permission = ADD_SHOEBOX_PERMISSION,
		extra_constructors = constructors,
		fti = ftis,
		).initialize(context)
#	utils.ContentInit(
#		PROJECTNAME + ' Content',
#		content_types = content_types,
#		permission = ADD_ACCOUNT_PERMISSION,
#		extra_constructors = constructors,
#		fti = ftis,
#		).initialize(context)
#	utils.ContentInit(
#		PROJECTNAME + ' Content',
#		content_types = content_types,
#		permission = ADD_ENTRY_PERMISSION,
#		extra_constructors = constructors,
#		fti = ftis,
#		).initialize(context)
	
	##
	## Adds the Tool
	##
#	import ShoeBoxTool
#	tools = (ShoeBoxTool.ShoeBoxTool, )
#	utils.ToolInit(
#		'ShoeBox',
#		tools=tools,
#		product_name='ShoeBox', 
#		icon = 'tool.png',
#		).initialize(context)

		